<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Canvas</title>
</head>
<body>
  <!-- 
    1.准备一个具备宽高的canvas  其本身只是一个画布  不具备绘图能力
      绘制画布内容由js控制
   -->
   <canvas id="charts" width="800" height="400"></canvas>

   <script>
    //  2.获取画笔
    const charts = document.getElementById('charts')
    const context = charts.getContext('2d')
    
    console.log(context);

    context.moveTo(100,100)
    context.lineTo(200,200)
    context.lineTo(200,100)
    context.lineTo(100,100)

    // context.fillStyle = 'lightblue'
    context.fill()
   </script>
</body>
</html>